package com.loghead
{
	public class LogType
	{
		//Types
		public static const INFO:LogType = new LogType( "info", 0 );
		public static const DEBUG:LogType = new LogType( "debug", 0x0000ff, "#0000FF" );
		public static const ERROR:LogType = new LogType( "error", 0xff0000, "#FF0000" );
		
		private static var _hasInitialized:Boolean;
		
		private static var _types:Array;
		
		private static function init():void
		{
			_types = new Array();
			addType( INFO );
			addType( DEBUG );
			addType( ERROR );
			_hasInitialized = true;
		}
		
		public static function getTypeByName( name:String ):LogType
		{
			if( !_hasInitialized ) init();
			var type:LogType = _types[ name ];
			return type;
		}
		
		private static function addType( type:LogType ):void
		{
			_types[type.name] = type;			
		}
		
				
		//Non static properties
		
		private var _name:String;
		
		private var _color:int;
		
		private var _colorString:String;
			
		public function LogType( name:String, color:int = 0, colorString:String = "0")
		{
			_name = name;
			_color = color;
			_colorString = colorString;
		}
		
		// name getter
		public function get name():String  { return _name; }
		
		// color getter
		public function get color():int  { return _color; }
			
		// colorString getter
		public function get colorString():String  { return _colorString; }				
		
	}
}